package com.tencet.service.Impl;

import com.tencet.dao.WithdrawalDAO;
import com.tencet.dao.impl.WithdrawalDAOImpl;
import com.tencet.service.Withdrawal;

/**
 * @author: @date: 2022/7/20 22:37 A
 * @description: 提现
 */
public class WithdrawalImpl implements Withdrawal {
    private final WithdrawalDAO wd = new WithdrawalDAOImpl();

    //判断二类账户余额是否足够
    @Override
    public boolean trueOrFalse(int money, String card2_num) {
        int balance = wd.getBalance(card2_num);
        if (balance >= money) {
            return true;
        } else {
            return false;
        }

    }
    //判断转账密码是否正确
    @Override
    public boolean confirmPassword(String password, String phone) {

        System.out.println(password+"2222222222222222");
        String password1 = wd.getPassword(phone);
        System.out.println(password1);
        System.out.println("到1");
        if (password1.equals(password)) {
            System.out.println("到2");
            return true;
        } else {
            System.out.println("到3");
            return false;
        }
    }
    //转账
    @Override
    public void withdrawal(int money, String account_id1, String card2_num) {
        boolean b = wd.changeBalance(money, account_id1, card2_num);
    }

}